package com.arpa.wms.controller;

import com.arpa.core.web.Result;
import com.arpa.wms.domain.dto.AuthDto;
import com.arpa.wms.service.ITokenManagerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;


/**
 * 数据导出任务
 *
 * @author leo
 */
@Api(tags = "token生成工具")

@RestController
@RequestMapping(value = "/token")
@Log4j2
public class TokenController {

    private final ITokenManagerService tokenManagerService;


    public TokenController(ITokenManagerService tokenManagerService ) {
        this.tokenManagerService = tokenManagerService;
    }

    @ApiOperation(value = "获取token", notes = "获取token")
    @ApiResponses(@ApiResponse(code = 0, message = "success", response = AuthDto.class))
    @PostMapping("create")
    public Result getToken(AuthDto dto, HttpServletRequest request) {
        tokenManagerService.getToken(dto);
        return Result.ok();

    }

}
